package me.jiatao.jetpack.databinding;

import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.databinding.ObservableField;
import android.databinding.ObservableInt;

import me.jiatao.jetpack.BR;

/**
 * Created by JiaTao on 2018/9/30.
 * Email: 535318720@qq.com
 * Version: 1.0
 * Description:
 */
public class User extends BaseObservable {
    private String firstName;
    private String lastName;
    public final ObservableField<String> address=new ObservableField<>();
    public final ObservableInt age = new ObservableInt();

    public User(String firstName, String lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
    }

    @Bindable
    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
        notifyPropertyChanged(BR.firstName);
    }

    @Bindable
    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
        notifyPropertyChanged(BR.lastName);
    }

    @Override
    public String toString() {
        return "User{" +
                "firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                ", address=" + address.get() +
                ", age=" + age.get() +
                '}';
    }
}
